deviceId=$1
appName=$2
if [ $# != 2 ]; then
	echo "sh battery-monkey.sh deviceId appName"
	exit;
fi
currentDir=$(cd "$(dirname "$0")"; pwd)

echo "start monitor "$appName" ..."
sh $currentDir/src/main/resources/get-android-pid.sh ${deviceId} ${appName}
echo "release monkey on "$appName" ..."
sh $currentDir/src/main/resources/get-android-monkey.sh $deviceId $appName 20000 &
sleep 30
echo "kill all scripts and monkey"
sh $currentDir/src/main/resources/kill-scripts-android.sh
echo "analyse the result..."
mvn install -DtestFile=testng-android-cpu.xml
cp -r $currentDir/target $currentDir/target-$appName
echo "sleep 20 seconds..."
sleep 20
